home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
emulator
/
bsvc-1.000
/
bsvc-1
/
bsvc-1.0.4
/
src
/
SimHector
/
devices
/
DeviceRegistry.cxx
next >
Wrap
C/C++ Source or Header
|
1995-07-26
|
2KB
|
56 lines
/////////////////////////////////////////////////////////////////////////////// //
//
// DeviceRegistry.cxx
//
// This class keeps up with a list of all of the availible devices and
// allocates them. It's derived from the BasicDeviceRegistry
//
// By: Bradford W. Mott
// October 30,1993
//
///////////////////////////////////////////////////////////////////////////////
#include <iostream.h>
#include "DeviceRegistry.hxx"
#include "RAM.hxx"
///////////////////////////////////////////////////////////////////////////////
// Array of device information (name, description, tcl script)
///////////////////////////////////////////////////////////////////////////////
const DeviceInformation DeviceRegistry::device_info[] = {
{"RAM",
"Random Access Memory",
#include "RAM.scr"
}
};
///////////////////////////////////////////////////////////////////////////////
// The Constructor
///////////////////////////////////////////////////////////////////////////////
DeviceRegistry::DeviceRegistry()
: BasicDeviceRegistry(device_info,
sizeof(device_info)/sizeof(DeviceInformation))
{}
///////////////////////////////////////////////////////////////////////////////
// Create a device with the given name (return 1=OK,0=ERROR)
///////////////////////////////////////////////////////////////////////////////
int DeviceRegistry::Create(String& name, String& args, BasicCPU *cpu,
BasicDevice* &device)
{
if (name=="RAM")
device=new RAM(args, cpu);
else
return(0);
// If the device's error message is not empty then return error
if(device->GetErrorMessage()!="")
{
delete device;
return(0);
}
return(1);
}